package com.wjj.demo.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

import com.wjj.demo.R;

import java.util.List;

/**
 * Created by Wjj on 16/11/22.
 */
public class XXlistviewAdapter extends BaseAdapter{

    private List<String> mDatas;
    private Context mContext;
    private LayoutInflater inflater;

    public XXlistviewAdapter(List<String> mDatas, Context context) {
        this.mDatas = mDatas;
        this.mContext = context;
        this.inflater = LayoutInflater.from(context);
    }

    @Override
    public int getCount() {
        return mDatas.size();
    }

    @Override
    public Object getItem(int i) {
        return mDatas.get(i);
    }

    @Override
    public long getItemId(int i) {
        return i;
    }

    @Override
    public View getView(int i, View view, ViewGroup viewGroup) {
        view = inflater.inflate(R.layout.item_xxlistview, viewGroup, false);
        TextView view1= (TextView) view.findViewById(R.id.dd);

        view1.setText(mDatas.get(i));
        return view;
    }
}
